<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        html,
        body {
            background-color: aqua;
            /* border: 1px solid red; */
            width: 100%;
            height: 100%;
        }

        body {
            margin: 0;
            border: 1px solid red;
        }

        .zz {
            width: 100%;
            height: 100%;
            background-color: yellow;
            border: 1px solid green;
            top: 0;
            position: absolute;
            display: none;
            background-color: rgba(87, 69, 155, 0.3);
        }

        .alert {
            width: 200px;
            height: 100px;
            background-color: beige;
            display: flex;
            margin: auto auto;
            margin-top: 200px;
            /* align-items: center; */
        }

        .qd {
            margin: auto auto;
            margin-bottom: 10px;
            margin-right: 10px;
        }
    </style>
</head>

<body>
    <!-- html+css模拟alert弹出框
    - 弹出之后，网页内容不允许操作（遮罩层） -->
    <input type="text">
    <button id="btn">确定</button>
    <div class='zz'>
        <div class="alert">
            <button class="qd">确定确定</button>
        </div>
    </div>
    <script>
        var btn = document.getElementById('btn')
        let text = document.getElementsByTagName('input')[0]
        let alert = document.querySelector('.alert')
        let zz = document.querySelector('.zz')
        let qd = document.querySelector('.qd')
        let alertinht = alert.innerHTML
        btn.onclick = () => {
            zz.style.display = 'block'
            console.log(text.value, alert.innerHTML)
            alert.innerHTML = text.value + alertinht
            qd = document.querySelector('.qd')
            // console.log(qd,'qwewqe')
            qd.onclick = () => {
                // console.log(111)
                zz.style.display = 'none'
                // console.log(qd)
            }
        }
        // console.log(qd)
    </script>
</body>

</html>